<extend name="Include:Layout"/>
<block name="title">当前课程</block>
<block name="style">
<style>
.weui_cell_bd p{font-size:14px;color:#999;}
</style>
</block>

<block name="main">
	<div class="weui_tab">
		
		<div class="weui_tab_bd container" id="container">
			<div class="weui_tab">
		        <div class="weui_navbar">
		            <div class="weui_navbar_item weui_bar_item_on">当前课程</div>
		            <div class="weui_navbar_item" onclick="self.location='{:U('yaodian')}'">本周要点</div>
		            <div class="weui_navbar_item" onclick="self.location='{:U('zuoye')}'">作业布置</div>
		        </div>
		        <div class="weui_tab_bd" id="content" style="margin-top:0px;">
					<div class="weui-pull-to-refresh-layer weui-pull-to-refresh">
					    <div class="pull-to-refresh-arrow"></div> <!-- 上下拉动的时候显示的箭头 -->
					    <div class="pull-to-refresh-preloader"></div> <!-- 正在刷新的菊花 -->
					    <div class="down">下拉刷新</div><!-- 下拉过程显示的文案 -->
					    <div class="up">释放刷新</div><!-- 下拉超过50px显示的文案 -->
					    <div class="refresh">正在刷新...</div><!-- 正在刷新时显示的文案 -->
					</div>
					<div id="data-content"></div>
					<div class="weui-infinite-scroll">
						<div class="infinite-preloader"></div>
					</div>
				</div>
		    </div>
	    </div>
		
		<php>$curbar = 2;</php>
    	<include file="Include:navbar" />
    </div>
<script id="data-tpl" type="text/html">
<div class="weui_panel">
   	<div class="weui_panel_bd">
     	<div class="weui_media_box weui_media_small_appmsg">
       		<div class="weui_cells weui_cells_access">
         		<a class="weui_cell" href="{:U('article')}">
           			<div class="weui_cell_bd weui_cell_primary">
           				<h4>音乐课 (预约课程)</h4>
             			<p>上课地址：杭州外国语学校，xx楼301室</p>
             			<p>上课时间：2016-08-08 上午09:30</p>
           			</div>
           			<span class="weui_cell_ft"></span>
        	 	</a>
       		</div>
     	</div>
   	</div>
</div>
</script>
</block>

<block name="script">

<script>
//监听下拉刷新
$("#content").pullToRefresh();
$("#content").on("pull-to-refresh", function() {
	load();	
});
var loading = false;  //状态标记
$(function () {
	//第一次加载数据
	load();
	
	//缴费记录
	$('#content').infinite();
	//$("#page_container").popup();
	
	$('#content').infinite().on("infinite", function() {
	  	if(loading) return;
	  	loading = true;
	  	load();
	  	
	});
});
function load(){
	$.showLoading("正在加载...");
	
	//$.get('',function(){
		setTimeout(function(){
			var html = '' ;
			var json = {};
			for(var i = 0 ; i < 10 ; i++){
				html += template('data-tpl',json);
			}
			$('#data-content').append(html);
			$.hideLoading();
			$("#content").pullToRefreshDone();
			loading = false;
		},300);//模拟延时
		
	//});
	
}
</script>
</block>